<?php

namespace app\batch;

use think\console\Command;
use think\console\Input;
use think\console\Output;
use think\facade\Debug;
use app\models\{Business, BusinessLog, Goods, GoodsSpec, Order, OrderGoods, Recpeople, Withdraw};
use think\Db;
use think\facade\Log;

class DataStatis extends Command
{
    protected $open = false;
    protected function configure()
    {
        $this->setName('DataStatis')->setDescription('平台数据统计');
    }

    protected function execute(Input $input, Output $output)
    {
        $this->doCron();
        die();
    }

    protected function doCron()
    {
        ini_set('max_execution_time', 0);
        //商家累计总营业额排行榜
        $list = (new Business())->alias('b')
            ->field(['sum(o.total)' => 'totals'])
            ->join('order o', 'b.id= o.businessid')->group('b.id')->select();
        dump($list);
    }
}
